package com.jxc.dao.impl;

import java.util.Date;
import java.util.List;

import javax.annotation.Resource;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.jxc.entity.TbEmployee;
import com.jxc.dao.UsersBiz;
import com.jxc.dao.UsersDao;
import com.jxc.utils.UtilDate;

public class UsersBizImpl implements UsersBiz {
	@Resource private UsersDao usersDao;
	private Log log = LogFactory.getLog(getClass());
	
	public List login(String name, String password) {
		List list =usersDao.login(name);
		if(list.size()>0){
			Object[] obj=(Object[])list.get(0);
			TbEmployee Employee=(TbEmployee) obj[0];
			if(Employee.getPwd().equals(password)){
				log.info("用户"+name+"在"+UtilDate.timeToString(new Date())+"时间登陆系统");
				return list;
			}
		}
		return null;
	}

	public TbEmployee login(int name) {
		TbEmployee Employee=this.usersDao.FindById(name);
		return Employee;
	}
	
	
	
}
